<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org">

<head>
    <meta charset="utf-8"/>
    <title></title>
</head>
<link rel="stylesheet" type="text/css" th:href="@{/css/head.css}" href="css/head.css"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/reset.css}" href="css/reset.css"/>
<link rel="stylesheet" type="text/css" th:href="@{/css/footer.css}" href="css/footer.css"/>
<body>
<div th:fragment="topbar">
    <!--		引入头部公共代码-->
    <div class="navigation-fix ">
        <div class="container relative clearfix">
            <i class="icon-logo-small absolute"></i>
            <ul class="nav-teb absolute clearfix">
                <li class="nav-teb-item fl">
                    <a href="/index">首页</a>
                </li>

                <li th:each="p : ${session.productTypeList }" class="nav-teb-item fl">
                    <a th:href="@{/product/catalog(ptypeId=${p.ptypeId})}" th:text="${p.ptypeName}"></a>
                </li>
            </ul>
            <div  class="fix-shopcar fr relative">
                <form action="/shoppingcart/cars" method="get">
                    <button type="submit"><span class="car-logo absolute" style="cursor: pointer"></span></button>
                    <input type="hidden" name="customerId" th:value="${session.customerId}"/>
                    <span id="nums" class="shopnum absolute" th:text="${session.count}==null?'0':${session.count}">0</span>
                </form>
            </div>
            <div class="fix-cus fr relative" id="jumpPersonalCenter">

            </div>
            <i class="fix-search fr"></i>
        </div>
    </div>
    <!--页头headbox-->
    <div class="headbox">
        <div class="nav_bac">
            <div class="container clearfix">
                <div class="nav_left fl clearfix">
                    <div class="title-l fl">
                        <a href="#">好的生活，没那么贵</a>
                    </div>
                    <div class="title-l fl">
                        <div class="lababox">
                            <img th:src="@{/img/d132c2561f18f1149d566a60d05fd9b7.gif}"/>
                        </div>
                    </div>
                    <div class="title-l2 fl">
                        <ul>
                            <li>
                                <a href="#">【5折SALE】丝滑莫代尔内裤等5折疯抢</a>
                            </li>
                        </ul>
                    </div>
                </div>
                <div class="nav_right fr clearfix">
                    <div class="login-register fl clearfix">
                        <div class="login fl" th:if="${session.customerId}==null">
                            <a id="login_tz" th:href="@{/customerLogin/login}" th:text="'登录'">登录</a>
                        </div>
                        <div class="login fl" th:if="${session.customerId}!=null">
                            <a  th:href="@{/customer/person_center}" th:text="${session.customerId}+',用户你好'">登录</a>
                        </div>
                        <div class="register fl" th:if="${session.customerId}==null">
                            <a th:href="@{/customerLogin/register}">注册</a>
                        </div>
                        <div class="register fl" th:if="${session.customerId}!=null">
                            <a th:href="@{/customerLogin/login}">注销</a>
                        </div>
                    </div>
                    <div class="nav-item fl">
                        <div class="nav-item-pipe">
                            <a href="personal-center.html">我的订单</a>
                        </div>
                    </div>
                    <div class="nav-item fl">
                        <div class="nav-item-pipe">
                            <a href="personal-center.html">会员</a>
                        </div>
                    </div>
                    <div class="nav-item fl">
                        <div class="nav-item-pipe">
                            <a href="personal-center.html">甄选家</a>
                        </div>
                    </div>
                    <div class="nav-item fl">
                        <div class="nav-item-pipe">
                            <a href="#">企业采购</a>
                        </div>
                    </div>
                    <div class="nav-item fl">
                        <div class="nav-item-pipe">
                            <a href="#">
                                <span>客户服务</span>
                                <i class="icon-xiala"></i>
                            </a>
                        </div>
                        <div class="icon-sanjiao absolute"></div>
                        <div class="customer-service absolute">
                            <a href="#">在线客服</a>
                            <a href="#">帮助中心</a>
                            <a href="#">商务合作</a>
                            <a href="#">开放平台</a>
                        </div>
                    </div>
                    <div class="nav-item fl">
                        <div class="nav-item-pipe">
                            <a href="#">
                                <i class="icon-phone1"></i>
                                <span>APP</span>
                            </a>
                        </div>
                        <div class="icon-sanjiao absolute"></div>
                        <div class="APPQR-code absolute">
                            <div class="APPQR-img"><img th:src="@{/img/APPQRCODE.png}"/></div>
                            <span>下载领1000元新人礼包</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="classification">
        <div class="container relative clearfix">
            <a href="#" class="wangyi-logo absolute">
                <i class="icon-logo"></i>
            </a>
            <div class="carbox fr relative">
                <form action="/shoppingcart/cars" method="get">
                    <!--<input type="hidden" th:value="${session.customerId}" name="customerId"/>-->
                    <button type="submit"><span class="car-logo absolute" style="cursor: pointer"></span></button>
                    <input type="hidden" name="customerId" th:value="${session.customerId}"/>
                    <span id="nums" class="shopnum absolute" th:text="${session.count}==null?'0':${session.count}">0</span>
                </form>
            </div>
            <div class="searchbox relative">
                <form action="/product/search_product" method="post">
                    <input class="Product-input absolute" type="text" name="keyword" id="seach" th:value="${keyword} == '' ? '' : ${keyword}"   placeholder="小龙虾9.9元再送一盒"/>
                    <button type="submit" ><span class="icon-search absolute" style="cursor: pointer;"></span></button>
                </form>

            </div>
            <ul class="nav-teb absolute clearfix">
                <li class="nav-teb-item fl">
                    <a th:href="@{/index}">首页</a>
                </li>
                <li th:each="p : ${session.productTypeList}" class="nav-teb-item fl">
                    <a th:href="@{/product/catalog(ptypeId=${p.ptypeId})}" th:text="${p.ptypeName}"></a>

                        <div th:class="${p.ptypeClass}">
                            <ul class="homeneirong clearfix" >
                                <div class="home-group fl" th:each="pc:${p.productTypeChildren}">
                                    <div class="group-title" th:text="${pc.ptypeName}"></div>
                                    <div class="group-pru" th:each="pcc:${pc.productTypeChildren}">
                                        <a href="#">
                                            <img th:src="@{${pcc.ptypeImg}}" />
                                            <span th:text="${pcc.ptypeName}"></span>
                                        </a>
                                    </div>
                                </div>
                            </ul>
                        </div>


                </li>
                <li class="nav-teb-item-splise"></li>
                <i class="icon-jianjiao"></i>
            </ul>

        </div>
    </div>

</div>
<script th:src="@{/js/jquery-3.3.1.min.js}" src="js/jquery-3.3.1.min.js" type="text/javascript" charset="utf-8"></script>


<script type="text/javascript">

    function findAllDepts() {
        $.ajax({
            async : true,    //表示请求是否异步处理
            type : "post",    //请求类型
            url : "/get_cart_num",//请求的 URL地址
            dataType : "json",//返回的数据类型
            success: function (data) {
                console.log(data);  //在控制台打印服务器端返回的数据
                console.log(data.cartNum)
                var num = data.cartNum + '';
                $("#shopping_num").text(num)

            },
            error:function (data) {
                alert(data.result);
            }
        });
    };
    $(document).ready(function () {
        findAllDepts();  //页面加载完成就执行该方法
        $('#jumpPersonalCenter').click(function () {
            alert("haha");
            window.location.href="/customer/person_center";
        })
    });

</script>
<script th:src="@{/layer-v3.1.1/layer/layer.js}" src="layer-v3.1.1/layer/layer.js" type="text/javascript" charset="utf-8"></script>
<script type="text/javascript">


</script>

</body>

</html>